import 'package:flutter/material.dart';
import 'package:hospitable_rental/pages/home/advisory/advisory_item.dart';
import 'package:hospitable_rental/pages/home/advisory/advisory_item_widget.dart';
import 'package:hospitable_rental/routes/routes.dart';
import 'package:hospitable_rental/widgets/search_bar/index.dart';

class AdvisoryIndex extends StatefulWidget {
  const AdvisoryIndex({Key? key}) : super(key: key);

  @override
  _AdvisoryIndexState createState() => _AdvisoryIndexState();
}

class _AdvisoryIndexState extends State<AdvisoryIndex> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: SearchBar(
          onSearch: () => Navigator.of(context).pushNamed(Routes.notFound),
        ),
        backgroundColor: Colors.white,
      ),
      body: ListView.builder(
        itemCount: advisoryItemList.length,
        itemBuilder: _itemBuilder,
      ),
    );
  }

  Widget _itemBuilder(BuildContext context, int index) {
    return AdvisoryItemWidget(advisoryItemList[index]);
  }
}
